/*
 * @Description:Duration类
 * 
 * @Author: rendc
 * 
 * @Date: 2025-07-29 14:39:59
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2025-07-29 14:49:34
 */

public class Duration {

  private int hour;
  private int min;
  private int sec;

  // 无参构造器
  public Duration() {

  }

  // 全参构造器
  public Duration(int hour, int min, int sec) {
    this.hour = hour;
    this.min = min;
    this.sec = sec;
  }

  // 单参构造器
  public Duration(int seconds) {
    // this(hour,min,sec);
    int hour, min, sec;
    hour = seconds / 3600;
    min = (seconds % 3600) / 60;
    sec = seconds % 60;
    this.hour = hour;
    this.min = min;
    this.sec = sec;
  }

  public int getHour() {
    return hour;
  }

  public int getMin() {
    return min;
  }

  public int getSec() {
    return sec;
  }

  // 获取总秒数
  public int getTotalSeconds() {
    return sec + (min * 60) + (hour * 60 * 60);
  }

  // disp
  public void disp() {
    System.out.println("hour:" + hour);
    System.out.println("min:" + min);
    System.out.println("sec:" + sec);
    System.out.println("Seconds:" + getTotalSeconds());
  }
}